package Eyjafjalla.effect;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.MathUtils;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.core.CardCrawlGame;
import com.megacrit.cardcrawl.core.Settings;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.vfx.AbstractGameEffect;

public class MarkFireBreathEffect extends AbstractGameEffect {
    public MarkFireBreathEffect(AbstractCard card){
        this(card,0.5F);
    }

    public MarkFireBreathEffect(AbstractCard card,float duration){
        this.card = card;
        this.startingDuration = 0.5F;
        this.duration = duration;
        this.deltaY = 0F;
    }

    float deltaY;
    float x;
    float y;
    float height;
    float vfxTimer = 0F;

    AbstractCard card;

    @Override
    public void update() {
        if(startingDuration==duration){

        }
        this.scale = card.drawScale * Settings.scale;
        this.rotation = card.angle;
        this.height = scale * 512F;
        this.deltaY = height *(0.5F- duration/startingDuration);
        this.x = card.current_x + MathUtils.sin(rotation)*deltaY;
        this.y = card.current_y + MathUtils.cos(rotation)*deltaY;

        this.vfxTimer -= Gdx.graphics.getDeltaTime();
        if (this.vfxTimer < 0.0F) {
            this.vfxTimer += 0.016F;
            AbstractDungeon.effectsQueue.add(new FireBreathParticleEffect(this.x, this.y));
            AbstractDungeon.effectsQueue.add(new FireBreathParticleEffect(this.x, this.y));
        }

        this.duration -= Gdx.graphics.getDeltaTime();
        if (this.duration < 0.0F) {
            this.isDone = true;
        }
    }

    @Override
    public void render(SpriteBatch spriteBatch) {

    }

    @Override
    public void dispose() {

    }
}

